<template>
  <!--字段说明-->
  <el-dialog title="字段说明" v-model="fieldInfoVisible" @close="closeDialog">
    <div style="margin-left: 20px;margin-top: 20px;">
      数据类型【{{dataType}}】应上传符合以下字段要求的Shp文件集合.
    </div>
    <div style="padding:20px;">
      <el-table :data="fieldInfoData" stripe>
        <el-table-column property="number" label="序号" width="55"></el-table-column>
        <el-table-column property="type" label="数据类型" width="100"></el-table-column>
        <el-table-column property="require" label="是否必填" width="100"></el-table-column>
        <el-table-column property="name" label="数据名称" width="200"></el-table-column>
        <el-table-column property="example" label="数据说明"></el-table-column>
      </el-table>
    </div>
  </el-dialog>
</template>
<script setup>
const fieldInfoVisible = ref(false);
const dataType = ref("");
const fieldInfoData = ref([]);

const props = defineProps({
  dataType: {
    type: String,
    default: ""
  },
});
watch(() => props.dataType, val => {
  dataType.value = val;
  //选择数据类型，设置字段说明表格内容
  setFileInfoTableData(val);
},{ deep: true, immediate: true });

const emits = defineEmits(['closeFieldInfoDialog']);
const closeDialog = ()=>{
  emits("closeFieldInfoDialog");
}

//选择数据类型，设置字段说明表格内容
function setFileInfoTableData(dataType){
  //清空
  fieldInfoData.value = [];
  //根据数据类型设置字段说明表格内容
  if(dataType=="重大工程历史震害"){
    fieldInfoData.value = [
      {number: "1", type: "文本型", require: "是", name: "地震名称", example: "100字长度"},
      {number: "2", type: "文本型", require: "是", name: "发生时间", example: "日期、时间选择，年月日、时分秒"},
      {number: "3", type: "文本型", require: "是", name: "震级", example: "20字长度"},
      {number: "4", type: "文本型", require: "是", name: "重大工程类型", example: "候选值：输油管线、输气管线、核电站、水库大坝"},
      {number: "5", type: "文本型", require: "是", name: "地震动参数（烈度）", example: "保留小数点后4位"},
      {number: "6", type: "文本型", require: "是", name: "破坏状态", example: "100字长度"},
      {number: "7", type: "文本型", require: "否", name: "省", example: "北京市"},
      {number: "8", type: "文本型", require: "否", name: "市", example: "北京市"},
      {number: "9", type: "文本型", require: "否", name: "区县", example: "西城区"},
    ];
  }else if(dataType=="水库大坝"){
    fieldInfoData.value = [
      {number: "1", type: "文本型", require: "是", name: "水坝名称", example: "100字"},
      {number: "2", type: "文本型", require: "否", name: "水坝地点", example: "100字"},
      {number: "3", type: "文本型", require: "是", name: "经度", example: "小数点后6位"},
      {number: "4", type: "文本型", require: "是", name: "纬度", example: "小数点后6位"},
      {number: "5", type: "文本型", require: "是", name: "库容（立方米）", example: "小数后2位"},
      {number: "6", type: "文本型", require: "是", name: "建造年代", example: "100字"},
      {number: "7", type: "文本型", require: "是", name: "坝长（米）", example: "小数后2位"},
      {number: "8", type: "文本型", require: "是", name: "坝高（米）", example: "小数后2位"},
      {number: "9", type: "文本型", require: "是", name: "顶宽（米）", example: "小数后2位"},
      {number: "10", type: "文本型", require: "是", name: "结构类型", example: "候选值：1水坝，2砌石坝，3堆石坝，4其他"},
      {number: "11", type: "文本型", require: "是", name: "水坝类型", example: "候选值：1均质坝，2心墙坝，3斜墙坝，4混合坝"},
      {number: "12", type: "文本型", require: "是", name: "设防烈度", example: "候选值：无设防，6度，7度，8度，9度，10度设防，加固，不详"},
      {number: "13", type: "文本型", require: "是", name: "位置", example: "候选值：上游，中游，下游"},
      {number: "14", type: "文本型", require: "是", name: "场地", example: "候选值：1基岩，2硬土(不液化)，3软土(液化)"},
      {number: "15", type: "文本型", require: "是", name: "填料", example: "候选值：1符合要求，2含粉土多、级配差，3风化表层土"},
      {number: "16", type: "文本型", require: "是", name: "坝基", example: "候选值：1岩性均一，2经过处理，3土层复杂，4未经处理"},
      {number: "17", type: "文本型", require: "是", name: "维护现状", example: "候选值：1正常，2抗震加固，3有裂缝、有渗漏，4曾发生事故，5曾发生事故处理过，6病险坝"},
      // {number: "18", type: "文本型", require: "是", name: "维护人", example: ""},
      // {number: "19", type: "文本型", require: "是", name: "维护时间", example: "时间格式为：2020-05-05"},
      // {number: "20", type: "文本型", require: "是", name: "维护人所属单位", example: ""},
      // {number: "21", type: "文本型", require: "是", name: "填表日期", example: "时间格式为：2020-05-05"},
      // {number: "18", type: "文本型", require: "否", name: "省", example: "北京市"},
      // {number: "19", type: "文本型", require: "否", name: "市", example: "北京市"},
      // {number: "20", type: "文本型", require: "否", name: "区县", example: "西城区"},
    ];
  }else if(dataType=="燃气-储气罐"){
    fieldInfoData.value = [
      {number: "1", type: "文本型", require: "否", name: "储气罐编码", example: "可不编码"},
      {number: "2", type: "文本型", require: "是", name: "储气罐名称", example: ""},
      {number: "3", type: "文本型", require: "是", name: "经度", example: "单位：度；示例：116.12345678"},
      {number: "4", type: "文本型", require: "是", name: "纬度", example: "单位：度；示例：39.12345678"},
      {number: "5", type: "文本型", require: "是", name: "型号", example: ""},
      {number: "6", type: "浮点型", require: "是", name: "公称容积", example: "单位：m³"},
      {number: "7", type: "浮点型", require: "是", name: "工作压力", example: "单位：MPa"},
      {number: "8", type: "浮点型", require: "是", name: "筒体内径", example: "单位：mm"},
      {number: "9", type: "浮点型", require: "是", name: "筒体高度", example: "单位：mm"},
      {number: "10", type: "浮点型", require: "是", name: "筒体、封头壁厚", example: "单位：mm"},
      {number: "11", type: "浮点型", require: "是", name: "参考重量", example: "单位：kg"},
      {number: "12", type: "文本型", require: "是", name: "结构材料", example: ""},
      {number: "13", type: "浮点型", require: "是", name: "导轨长度", example: "单位：m"},
      {number: "14", type: "浮点型", require: "是", name: "导轨高度", example: "单位：m"},
      {number: "15", type: "浮点型", require: "是", name: "导轨中腹厚度", example: "单位：m"},
      {number: "16", type: "文本型", require: "是", name: "基础形式", example: ""},
      {number: "17", type: "文本型", require: "否", name: "材料型号", example: "不同材料的型号，如Q235"},
      {number: "18", type: "浮点型", require: "否", name: "弹性模量", example: "单位：MPa"},
      {number: "19", type: "浮点型", require: "否", name: "屈服应力", example: "单位：MPa"},
      {number: "20", type: "浮点型", require: "否", name: "许用应力", example: "单位：MPa"},
      {number: "21", type: "整型", require: "否", name: "场地类别", example: "分类：1，2，3，4，单位：类；示例：1"},
      {number: "22", type: "整型", require: "否", name: "6度时液化程度", example: "分类：0无，1中等，2严重；示例：0"},
      {number: "23", type: "整型", require: "否", name: "7度时液化程度", example: "分类：0无，1中等，2严重；示例：0"},
      {number: "24", type: "整型", require: "否", name: "8度时液化程度", example: "分类：0无，1中等，2严重；示例：0"},
      {number: "25", type: "整型", require: "否", name: "9度时液化程度", example: "分类：0无，1中等，2严重；示例：0"},
      {number: "26", type: "整型", require: "否", name: "6度时震陷程度", example: "分类：0无，1中等，2严重；示例：0"},
      {number: "27", type: "整型", require: "否", name: "7度时震陷程度", example: "分类：0无，1中等，2严重；示例：0"},
      {number: "28", type: "整型", require: "否", name: "8度时震陷程度", example: "分类：0无，1中等，2严重；示例：0"},
      {number: "29", type: "整型", require: "否", name: "9度时震陷程度", example: "分类：0无，1中等，2严重；示例：0"},
      {number: "30", type: "浮点型", require: "否", name: "建设年代", example: "单位：年；yyyy格式；示例：2016"},
      {number: "31", type: "整型", require: "否", name: "设防烈度", example: "分类：0无设防，6度，7度，8度，9度；单位：度；示例：0"},
      {number: "32", type: "文本型", require: "否", name: "省", example: "北京市"},
      {number: "33", type: "文本型", require: "否", name: "市", example: "北京市"},
      {number: "34", type: "文本型", require: "否", name: "区县", example: "西城区"},
    ];
  }
  //显示字段说明
  fieldInfoVisible.value = true;
}
</script>
